﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wozuji.BLL;
using System.Web;
namespace Wozuji.Logic
{
    public static class Album
    {
        //public static new Wozuji.Model.album_t abm;
        //public static new Wozuji.Model.Photos_t ph;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="albumName">相册名称</param>
        /// <param name="albumRight">是否开放</param>
        /// <param name="albumTeam">相册所属用户组，如为个人为0</param>
        /// <returns>相册id</returns>
        public static int create(String albumName,bool albumRight,int albumTeam)
        {
            Wozuji.Model.album_t abm = new Wozuji.Model.album_t();
            abm.Album_Title = albumName;
            abm.Album_Member = Convert.ToInt32(HttpContext.Current.Session["userid"].ToString());

            abm.Album_Right = albumRight;
            abm.Album_Team = albumTeam;
            try
            {
                Wozuji.BLL.album_t abmbll= new Wozuji.BLL.album_t();
                
                return abmbll.Add(abm);

            }
            catch (Exception ex)
            {
                return 0;
            }

            
        }
        /// <summary>
        /// 向相册中增加照片
        /// </summary>
        /// <param name="photoPath">照片大图路径</param>
        /// <param name="photoSmallPath">照片小图路径</param>
        /// <param name="AlbumId">相册编号</param>
        /// <param name="photoName">照片名称</param>
        /// <param name="Userid">照片所属用户</param>
        public static int addPhotoToAlbum(String photoPath, String photoSmallPath, int AlbumId,string photoName,int Userid)
        {
            Wozuji.Model.Photos_t ph = new Wozuji.Model.Photos_t();
            ph.Photo_Path = photoPath;
            ph.Photo_Small = photoSmallPath;
            ph.Photo_Folder = AlbumId;
            ph.Photo_Name = photoName;
            ph.Photo_belong = Userid;
            Wozuji.BLL.Photos_t phbll = new Wozuji.BLL.Photos_t();
            return phbll.Add(ph);
        }
    }
}
